<template>
	<view class="indexs">
		<view class="header header_wi" :style="'padding-top: ' + navH + 'px;'">
			<view class="header_height" :style="'height:' + gaodu + 'px;line-height:' + gaodu + 'px;top:' + gaodutops + 'px;'">
				<view class="index_h_cont3">
					<view class="index_wenben_img" @tap="jumpzuo"><image :src="imgUrl + '/dzx_img33.png'" mode="widthFix"></image></view>
					<view class="index_wenben">{{ $t('page_cangkudizhi_list.warehouse_list') }}</view>
				</view>
			</view>
			<view class="coloe_title">s</view>
		</view>
		<view class="index_center" :style="'padding-top:' + (navH + 50) + 'px;'">
			<view class="cangkudizhi_list" v-if="cangkulist.length != 0">
				<view class="cangkudizhi_cont" v-for="(item, index) in cangkulist" :key="index">
					<view class="cangkudizhi_title">{{ item.shop_name }}</view>

					<view class="cangkudizhi_dis">
						<view class="cangkudizhi_l">
							<view class="cangkudizhi_t1">
								<image :src="imgUrl + '/dzx_img198.png'"></image>
								<text>{{ item.region.province }}{{ item.region.city }}{{ item.region.region }}{{ item.address }}</text>
							</view>
							<view class="cangkudizhi_t1">
								<image :src="imgUrl + '/dzx_img199.png'"></image>
								<text>{{ item.phone }}</text>
							</view>
						</view>
						<view class="cangkudizhi_r" @tap="chakan" :data-id="item.shop_id">{{ $t('page_cangkudizhi_list.check_the_details') }}</view>
					</view>
				</view>
			</view>
			<view class="my_dingdan_zanwu" v-else>
				<image :src="imgUrl + '/dzx_img43.png'"></image>
				<text>{{ $t('page_cangkudizhi_list.no_order_yet') }}</text>
			</view>
		</view>
	</view>
</template>

<script>
// pages/shouye/shouye_zkc/shouye_zkc.js
const app = getApp();

let request = require('../../../utils/require');

export default {
	data() {
		return {
			navH: app.globalData.navHeight,
			gaodu: app.globalData.height,
			gaodutops: app.globalData.top,
			imgUrl: app.globalData.imgUrl,
			cangkulist: [] //仓库列表
		};
	},
	/**
	 * 生命周期函数--监听页面加载
	 */ onLoad() {
		var that = this;
	},
	onShow() {
		var that = this;
		that.cangkulistFun();
	},
	/**
	 * 生命周期函数--监听页面初次渲染完成
	 */
	onReady: function() {},
	/**
	 * 生命周期函数--监听页面隐藏
	 */
	onHide: function() {},
	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload: function() {},
	/**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
	onPullDownRefresh: function() {},
	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom: function() {},
	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage: function() {},
	methods: {
		chakan(e) {
			uni.navigateTo({
				url: '/pages/indexs/cangkudizhi/cangkudizhi?id=' + e.currentTarget.dataset.id
			});
		},

		cangkulistFun() {
			var that = this;
			var data = {
				token: uni.getStorageSync('token')
			};
			if(uni.getStorageSync("usermark")){
				data['usermark'] = uni.getStorageSync("usermark").mark;
			}
			request.post(`index.php?s=/api/page/storageList&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				if (res.data.code == 1) {
					that.cangkulist = res.data.data
					console.log(res.data, 're?????');
				}
			});
		},

		jumpzuo() {
			uni.navigateBack();
		}
	}
};
</script>
<style>
@import './cangkudizhi_list.css';
</style>
